﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HynuIOTA.Respository
{
    public class HynuDbInit : DropCreateDatabaseIfModelChanges<HynuIOTAEntitiesContainer>
    {
        protected override void Seed(HynuIOTAEntitiesContainer context)
        {
            PerformInitialSetup(context);
            base.Seed(context);
        }

        public void PerformInitialSetup(HynuIOTAEntitiesContainer context)
        {
            // TODO: 
            // 1.创建网页Action

            // 2.创建所有Relo

            // 3.创建超级管理员User
            HynuIOTA.Entity.User admin = new Entity.User()
            {
                 UserName = "admin",
                 UserPassword = "admin123",
            };
            context.User.Add(admin);
            context.SaveChanges();
        }
    }
}
